package cn.lingyangwl.agile.misc.order;

import cn.lingyangwl.agile.misc.order.model.*;
import cn.lingyangwl.framework.core.response.*;
import cn.lingyangwl.framework.tool.core.exception.*;
import com.alibaba.cloud.nacos.NacosServiceAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author shenguangyang
 */
@Service
@ConditionalOnClass({FeignAutoConfiguration.class, NacosServiceAutoConfiguration.class})
public class OrderApiCloudImpl implements OrderApi {
    @Resource
    private RemoteOrderService service;

    @Override
    public void saveOrder(OrderSaveReq req) {
        Resp<?> resp = service.saveOrder(req);
        RetOps.of(resp).assertSuccess(e -> new BizException(e.getCode(), e.getMsg()));
    }
}
